package com.games.portal.mng;

import java.util.Calendar;

import javax.servlet.ServletContext;
import javax.servlet.ServletContextEvent;
import javax.servlet.ServletContextListener;

import com.games.portal.rest.model.Games;

public class XMLContextListener implements ServletContextListener {


	@Override
	public void contextDestroyed(ServletContextEvent arg0) {
		
	}

	@Override
	public void contextInitialized(ServletContextEvent arg0) {
		ServletContext servletContext = arg0.getServletContext();
		Games games = XmlParserManager.unmarshallGamesXml();
		System.out.println(games.toString());
		servletContext.setAttribute("gameList", games);
		servletContext.setAttribute("lastUpdated", Calendar.getInstance().getTime().getTime());
	}
	
	}
